$(function(){
	if(contractState=='2'||contractState=='0'){
		//如果合同期外，就不需要退场结算
		$('#checkSaveBtn').hide();
	}
	getContractList(recId);
});


//合同回填
function getContractList(recId){
	$.ajax({ 
	 	url: ctp + "/contractController/getWorkerContracts.shtml",
	    data: {recId:recId},
		type : 'POST',
		async:false, 
		dataType: "json",
		success : function(result) {
			var list=result.list;
			var html="";
			for (var i = 0; i < list.length; i++) {
				html += '<div class="smart-layer_carousel justone" id="' + list[i].rec_id + '">'
				+ '<img src="' + ctp + '/' + list[i].path + '" layui-src="' + ctp + '/' + list[i].path + '">'
				+ '<p></div>';
		    };
		    $('#contractList').html(html);
		    layui.layer.photos({
		        photos: '#contractList',
		        anim: 0
		    });
		}
	});
}

function contractDisable(){
	jconfirm("doContractDisable()", "确定要退场解约吗？");
	
}

function doContractDisable(){
	$.ajax({ 
	 	url: ctp + "/workerController/contractDisable.shtml",
	    data: {recId:recId},
		type : 'POST',
		async:false, 
		//dataType: "json",
		success : function(result) {
			if(result==''){
				jalert9("退场解约成功！");
				setTimeout(function(){
					parent.searchData();
					back();
				},WARN_TIME_OUT);
			}else{
				jalert(result);
			}
		}
	});
}







function back(){
	window.parent.closeDialogWin();
}